function testMsisdn(msisdn) {
    var myreg = /^((1)+\d{10})$/;
    if (myreg.test(msisdn)) {
        return false;
    } else {
        return true;
    }
}

function testMsisdn2(msisdn) {
    var myreg = /^((1)+\d{6})$/;
    if (myreg.test(msisdn)) {
        return false;
    } else {
        return true;
    }
}

function testPassword(password) {
    var myreg = /(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{6,30}/;
    if (myreg.test(password)) {
        return false;
    } else {
        return true;
    }
}

//判断是否为数字
function checkRate(input) {
    var re = /^[0-9]+.?[0-9]*/;//判断字符串是否为数字//判断正整数/[1−9]+[0−9]∗]∗/
    if (!re.test(input)) {
        return false
    } else {
        return true;
    }
}

//获取前个页面的的参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return "";
}

function isNull(param) {
    if (param == null) {
        return true;
    }
    var pa = param.trim();
    if (pa == "" || pa == null || pa == undefined) {
        return true;
    } else {
        return false;
    }
}

//判断一个月的时间差
function judetmentDate(startTime, endTime) {
    var time1 = startTime.replace(/\-/g, "/");
    var time2 = endTime.replace(/\-/g, "/");
    var date1 = new Date(time1);
    var date2 = new Date(time2);
    var days = parseInt(date2 - date1) / 1000 / 60 / 60 / 24;
    if (days <= 30 && days >= 0) {
        return false;
    } else {
        return true;
    }
}

//判断是否跨月
function judetmentMonth(startTime, endTime) {
    var time1 = startTime.substring(5, 7);
    var time2 = endTime.substring(5, 7);
    if (time1 == time2) {
        return true
    } else {
        return false;
    }
}

//时间格式转换
function formatDate(time) {
    var date = time.replace(/\-/g, "");
    return date;
}


function returnIndex() {
    $.ajax({
        type: 'post',
        async: false,
        url: '/util/findUser',
        success: function (json) {
            user = json;
            // if (json.duty == 0) {
            //     location.href = "./viewManage/smsViewManage.html";
            // } else {
            //     location.href = "./reportManage/smsSendFind.html";
            // }
            if (json.duty == 0) {
                $('iframe').attr('src', './viewManage/smsViewManage.html');
            } else {
                $('iframe').attr('src', './reportManage/smsSendFind.html');
            }
        }, error: function () {
            layer.msg('系统异常，请联系管理员处理!');
        }
    });
}

function returnIndex2() {
    $.ajax({
        type: 'post',
        async: false,
        url: '/util/findUser',
        success: function (json) {
            user = json;
            if (json.duty == 0) {
                location.href = "../viewManage/smsViewManage.html";
            } else {
                location.href = "../reportManage/smsSendFind.html";
            }
        }, error: function () {
            layer.msg('系统异常，请联系管理员处理!');
        }
    });
}


